#pragma once

#include "drawableactor.h"
#include <QStringList>
#include "vrdatacore_global.h"
#include <osgParticle/PrecipitationEffect>
#include <osg/ClipNode>
#include "drawable.h"

namespace VrDataCore
{
	class VRDATACORE_EXPORT Weather : public CoreBase::Drawable
	{
	public:
		Weather(CoreBase::ActorBase* owneractor,const QString& name = "Weather");
		osg::Node* getOSGNode();
		const osg::Node* getOSGNode() const;

		osgParticle::PrecipitationEffect* getPrecipitationEffect();
	protected:
		virtual ~Weather(){};
		
		osg::ref_ptr<osg::Group>						_node;
		osg::ref_ptr<osgParticle::PrecipitationEffect>	_precipitationEffect;
		osg::ref_ptr<osg::ClipNode>						_clipNode;
	};

	class VRDATACORE_EXPORT WeatherSetting:public DrawableActor
	{
	public:
		WeatherSetting();
	protected:
		~WeatherSetting();
		virtual void createDrawable();
	public:
		virtual void buildPropertyMap();
		virtual void onMapLoadEnd(CoreBase::Map*);
		void setColor(osg::Vec4 color);
		osg::Vec4 getColor();
		void setType(QStringList t);
		QStringList getType();
		void setIntensity(float i);
		float getIntensity();
		void setWind(osg::Vec3 w);
		osg::Vec3 getWind();
		void setSpeed(float speed);
		float getSpeed();
		void setNearTransition(float nt);
		float getNearTransition();
		void setFarTransition(float ft);
		float getFarTransition();
		void setParticleDensity(float d);
		float getParticleDensity();
		void setCellSize(osg::Vec3 cs);
		osg::Vec3 getCellSize();
		void setClipDistance(float cd);
		float getClipDistance();
		void changeType(const QStringList& t);
	private:
		void changeWeather(const QString& name);

		QStringList										_type;
		float											_speed;
		float											_nearTransition;
		float											_farTransition;
		float											_intensity;
		osg::Vec4										_color;
		osg::Vec3										_wind;
		float											_particleDensity;
		osg::Vec3										_cellSize;
		float											_clipDistance;
		bool											_open;
	};
}